package com.woniuxy.yogaapp.util;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

public class ShiroSession {
	public static Subject currentUser;
	public static Session session;

	public  static Session getSession() {
		return session;
	}

	public static Integer getUid() {
		session = SecurityUtils.getSubject().getSession();
		if (session == null) {
			return null;
		}
		// 1.获取该用的的uid
		Object uidObject =  session.getAttribute("uid");
		if (uidObject == null) {
			return null;
		}

		return (Integer)uidObject;
	}

}
